using System;
using System.Collections.Generic;
using Core.GameObjects.Entities;
using Core.GameObjects.Jobs;
using Core.GameObjects.Skills;
using Core.GameObjects.Nen;
using Core.GameObjects.Stats;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace Core.GameObjects.Items
{
    public struct Bonus
    {
        public BonusType Type;
        public short Amount;
        public float TimeStarted;
        public float Duration;
        public float ElapsedTime;
    }

    public enum BonusType
    {
        Disease,
        Magic,
        Poison,
        Potion,
        Other
    }

    public class Item : BaseItem, iDrawable
    {
        /// <summary>Items Cost</summary>
        public int Cost { get; protected set; }
        /// <summary>Does Item Have Nen</summary>
        public bool HasNen {get; protected set;}

        /// <summary>Is Item part of a Job</summary>
        public bool JobItem { get; protected set; }
        /// <summary>What part of a Job is this piece</summary>
        public byte JobItemPiece { get; protected set; }
        /// <summary>The job, if any, that this Item is a part of</summary>
        public Job Job { get; protected set; }
        /// <summary>Is this item part of a reward for a job</summary>
        public bool JobReward { get; protected set; }

        /// <summary>Spells that this item currently stores</summary>
        public List<NenAction> Spells { get; protected set; }

        /// <summary>Defensive Bonuses Provided by this Item</summary>
        public List<Bonus> DefensiveBonuses { get; protected set; }
        /// <summary>Offensive Bonuses Provided by this Item</summary>
        public List<Bonus> OffensiveBonuses {get; protected set;}
        /// <summary>Other Bonuses Provided by this Item</summary>
        public List<Bonus> MiscBonuses { get; protected set; }

        /// <summary>Does Item Auto Equip</summary>
        public bool AutoEquip { get; protected set; }
        /// <summary>Is Item Repairable</summary>
        public bool Repairable { get; protected set; }
        /// <summary>Is Item Inique</summary>
        public bool Unique { get; protected set; }
        /// <summary>Is Item Droppable</summary>
        public bool Droppable { get; protected set; }
        /// <summary>Is Item Tradeable</summary>
        public bool Tradeable { get; protected set; }

        /// <summary>Skills required to use this item</summary>
        public List<Skill> SkillsRequired { get; protected set; }
        /// <summary>Stats required to use this item</summary>
        public List<Stat> StatsRequired { get; protected set; }

        public Item(int ID, string Name, float Weight, float Size, ItemType Type)
            : base(ID, Name, Weight, Size, Type)
        {
            
        }

        //All classes that derive from this one must implement this function
        public virtual bool Use(ref GameObject target, ref Entity wielder) 
        {
            return false;
        }

        #region iDrawable Members
        public override void Draw(SpriteBatch spriteBatch, Point destPoint)
        {
            base.Draw(spriteBatch, destPoint);
        }

        #endregion
    }
}
